use crate::downloader::DownloadStatus;
use crate::url::Url;
use std::sync::mpsc;
mod impls;
pub struct Catcher {
    uid: usize,
    pub download_urls: Vec<Url>,
    threads_channel: mpsc::Receiver<DownloadStatus>,
    sender: mpsc::Sender<DownloadStatus>,
    thread_status: ThreadsStatus,
    pub max_thread: u64
}
///all  finished  successed           Errs threads return
#[derive(Debug)]
pub struct ThreadsStatus(u64, u64, u64);
impl ThreadsStatus {
    pub fn print_status(&self) {
        println!("successed: {}/{}", self.2, self.0);
        println!("finished: {}/{}", self.1, self.0);
    }
    pub fn is_all_finished(&self) -> bool {
        if self.0 != self.1 {
            false
        } else {
            true
        }
    }
}
